{% extends "base.html" %}
{% load i18n %}

{% block htmlhead %}
{{block.super}}
<style type="text/css" media="screen">
#filelist {
	background-color: white;
        padding: 10px;
        /*width: 800px;*/
        /*line-height: 200%;*/
        /*margin-right: 100px;*/
        border: 5px solid #ccc;
	width: 90%;
        margin-left: auto;
        margin-right: auto;
}

#anon1 {
	margin-left: auto;
	margin-right: auto;
}
</style>



<script type="text/javascript">
function submitform()
{
  var selA = jQuery("#anon1").getGridParam('selarrrow');
  var field = document.createElement("input");
  field.setAttribute("type","hidden");
  field.setAttribute("value",selA);
  field.setAttribute("name","selected");
  document.myform.appendChild(field);
  document.myform.submit();
}
</script>


 
<script src="/site_media/js/jquery.js" type="text/javascript"></script>
<script src="/site_media/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="/site_media/js/jquery.jqGrid.min.js" type="text/javascript"></script>

<link rel="stylesheet" type="text/css" media="screen" href="/site_media/css/ui-lightness/jquery-ui-1.7.2.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/site_media/css/ui.jqgrid.css" />



<script type="text/javascript">
jQuery(document).ready(function(){ 

jQuery("#anon1").jqGrid({
                        datatype: "local", 
                        height: 'auto', 
                        colNames:[ 'Title', 'Tags', 'Labels'], 
                        colModel:[ 
                           {name:'title',index:'title'}, 
                           {name:'tags',index:'tags'}, 
                           {name:'labels',index:'labels'}, 
					
                        ], 
			autowidth: true,
                        caption: "Objects for export",
			multiselect: true,
                        });

var mydata = [{% for key,object in objects.items %}
        {id:"{{key}}", title:"<a href=\"/hide/doc/{{key}}\">{{object.value.title}}</a>" , labels:"{{object.value.labels}}", tags:"{{object.value.tags}}"},
{% endfor %}];

for(var i=0;i<mydata.length;i++) {
	jQuery("#anon1").jqGrid('addRowData',mydata[i].id,mydata[i]);
}

});
					


</script>

{% endblock %}

{% block title %}
HIDE v1.5: Label Documents
{% endblock %}

{% block content %}
{% comment %}
<h1>HIDE v1.5</h1>
{% endcomment %}
<h2>Choose the documents and export format below</h2>
<form name="myform" method="post" action="#">
{% csrf_token %}
<input type="radio" name="type" value="xml" checked/> XML (universal format) <br/>
<input type="radio" name="type" value="json" /> JSON (javascript format) <br/>
<input type="radio" name="type" value="hl7"/> HL7 (common medical data format. coming soon.) <br/>
<input type="radio" name="type" value="fvs"/> FVS (sequence labeling feature vector format. coming soon.) <br/>
<a href="javascript: submitform()">Export Selected Documents</a> 
</form>
<div id="filelist">

<table id="anon1"></table>
  
  
</div>
{% endblock %}

